Imports AppliedRecognition.Speech.TaskSupport
Imports System.Drawing

<System.ComponentModel.DesignerCategory("Code")> _
Public Class IconImage
    Inherits Panel

    Public Sub New()
        MyBase.New()
        InitializeComponent()
    End Sub

    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    Private components As System.ComponentModel.IContainer
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        components = New System.ComponentModel.Container
        Me.BackColor = Color.FromArgb(0, 0, 0, 0)
    End Sub

    Protected Overrides Sub OnPaint(ByVal pe As System.Windows.Forms.PaintEventArgs)
        MyBase.OnPaint(pe)
        Dim r As New Rectangle(0, 0, Width, Height)
        Try
            pe.Graphics.DrawIcon(_ImageIcon, r)
        Catch ex As Exception
            pe.Graphics.DrawRectangle(Drawing.Pens.White, r)
            Debug.WriteLine(ex.ToString)
        End Try
    End Sub

    Private _ImageIcon As Icon
    Public Property ImageIcon() As Icon
        Get
            Return _ImageIcon
        End Get
        Set(ByVal Value As Icon)
            _ImageIcon = Value
        End Set
    End Property
End Class
